/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jeelabs.form;

import java.net.URISyntaxException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ApplicationScoped;

/**
 *
 * @author user
 */
@ManagedBean(name="MenuBean")
@ApplicationScoped
public class MenuBean {
    
    private LabsContainer labs;
    
    /*
     * If you want to change it - remember to add next labX.xhtml files in Web Pages
     */
    static int NUMBER_OF_LABS = 3;

    /** Creates a new instance of MenuBean */
    public MenuBean() {
        try {
            labs = new LabsContainer();
            this.addLabsToMenu(NUMBER_OF_LABS);
        } catch (URISyntaxException ex) {
            Logger.getLogger(MenuBean.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public List<Lab> getLabs() {
        return labs.getLabs();
    }
    
    private void addLabsToMenu(int numOfLabs) throws URISyntaxException {
        for (int i = 0; i < numOfLabs; i++) {
            labs.addLab(new Lab("lab" + i));
        }
    }
}
